<!DOCTYPE html>
<html lang="en">
  <head>
	<meta charset="utf-8">
	<title>Welcome to Throwbook</title>
	<meta name="description" content="">
	<meta name="author" content="">

	<?php
		$assetsPath = dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'assets';
		//$assetsPath = Yii::getPathOfAlias('webroot.themes.bootstrap.assets');
		$assetsBase = Yii::app()->assetManager->publish($assetsPath);
	?>
	<!-- Le styles -->
	<?php //Yii::app()->clientScript->registerCssFile($assetsBase.'/bootstrap/css/bootstrap.min.css'); ?>
	<?php //Yii::app()->clientScript->registerCssFile($assetsBase.'/bootstrap/css/bootstrap-responsive.min.css'); ?>
	<?php Yii::app()->clientScript->registerCssFile($assetsBase.'/h-app/css/h-application.css'); ?>

	<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
	<!--[if lt IE 9]>
	  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->

	<!-- Le fav and touch icons -->
	<link rel="shortcut icon" href="<?php echo $assetsBase; ?>/bootstrap/ico/favicon.ico">
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php echo $assetsBase; ?>/bootstrap/ico/apple-touch-icon-114-precomposed.png">
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php echo $assetsBase; ?>/bootstrap/ico/apple-touch-icon-72-precomposed.png">
	<link rel="apple-touch-icon-precomposed" href="<?php echo $assetsBase; ?>/bootstrap/ico/apple-touch-icon-57-precomposed.png">
  </head>

  <body>
	<?php $this->widget('bootstrap.widgets.BootNavbar', array(
		'fixed'=>'top',
		'brand'=>Yii::app()->params['projectName'],
		'brandUrl'=>Yii::app()->createAbsoluteUrl('/'),
		'collapse'=>true, // requires bootstrap-responsive.css
		'items'=>array(
			Yii::app()->user->isGuest?array():array(
				'class'=>'bootstrap.widgets.BootMenu',
				'items'=>array(
					array('label'=>'Text Books', 'url'=>array('/textbooks/department/index')),
					// array('label'=>'Jobs', 'url'=>'#'),
					array('label'=>'Classmate', 'url'=>array('/textbooks/profile/index')),
				),
			),
			Yii::app()->user->isGuest?'':
				'<form class="navbar-search pull-left" action="'.Yii::app()->createUrl('/textbooks/book/search').'" method="GET">
					<input type="text" class="search-query span2" name="search_book" value="'.(isset($_GET['search_book'])?CHtml::encode($_GET['search_book']):'').'" placeholder="Search Book" />
					<input type="submit" class="search-button btn" value="Go" />
				</form>',
			Yii::app()->user->isGuest?array():array(
				'class'=>'bootstrap.widgets.BootMenu',
				'htmlOptions'=>array('class'=>'pull-right'),
				'items'=>array(
					// array('label'=>Yii::app()->getModule('textbooks')->t("Profile"), 'url'=>array('/textbooks/profile/index')),
					'---',
					array('label'=>'Account', 'url'=>'#', 'items'=>array(
						// array('label'=>'Account settings', 'url'=>'#'),
						array('label'=>Yii::app()->getModule('textbooks')->t("Manage Your Books"), 'url'=>Yii::app()->createAbsoluteUrl('/textbooks/book/manage')),
						array('label'=>Yii::app()->getModule('textbooks')->t("Your Universities"), 'url'=>Yii::app()->createAbsoluteUrl('/textbooks/profile/universities')),
						array('label'=>Yii::app()->getModule('textbooks')->t("Your Courses"), 'url'=>Yii::app()->createAbsoluteUrl('/textbooks/profile/courses')),
						'---',
						array('label'=>Yii::app()->getModule('facebook')->t("Logout").' ('.Yii::app()->user->model->email.')', 'url'=>Yii::app()->facebook->getLogoutUrl(array('next'=>Yii::app()->createAbsoluteUrl('/facebook/connect/logout')))),
					)),
				),
			),
		),
	)); ?>
	
	<?php //if (Yii::app()->user->isGuest) $this->widget('application.modules.user.widgets.HUserLoginWidget'); ?>
	
	<div class="container">
	
		<?php if(isset($this->breadcrumbs) && count($this->breadcrumbs)):?>
			<?php $this->widget('bootstrap.widgets.BootBreadcrumbs', array(
				'links'=>$this->breadcrumbs,
				'homeLink'=>false,
			)); ?>
		<?php endif?>

		<?php echo $content; ?>

		<hr>

		<footer>
			<p><?php echo Yii::app()->params['copyrightInfo']; ?></p>
		</footer>

	</div> <!-- /container -->

	<!-- Le javascript
	================================================== -->
	<!-- Placed at the end of the document so the pages load faster -->
	<?php Yii::app()->clientScript->registerScriptFile('/javascript/jquery.json-2.3.min.js', CClientScript::POS_END); ?>
	<?php //Yii::app()->clientScript->registerCoreScript('jquery'); ?>

	<!-- Piwik --> 
	<script type="text/javascript">
	var pkBaseURL = (("https:" == document.location.protocol) ? "https://throwbook.com/piwik/" : "http://throwbook.com/piwik/");
	document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
	</script><script type="text/javascript">
	try {
	var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
	piwikTracker.trackPageView();
	piwikTracker.enableLinkTracking();
	} catch( err ) {}
	</script><noscript><p><img src="http://throwbook.com/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
	<!-- End Piwik Tracking Code -->

  </body>
</html>